use futures::{future, future::BoxFuture, Stream, stream, future::FutureExt, stream::TryStreamExt};
use hyper::{Request, Response, StatusCode, Body, HeaderMap};
use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE};
use log::warn;
#[allow(unused_imports)]
use std::convert::{TryFrom, TryInto};
use std::error::Error;
use std::future::Future;
use std::marker::PhantomData;
use std::task::{Context, Poll};
use swagger::{ApiError, BodyExt, Has, RequestParser, XSpanIdString};
pub use swagger::auth::Authorization;
use swagger::auth::Scopes;
use url::form_urlencoded;

#[allow(unused_imports)]
use crate::{models, header, AuthenticationApi};

pub use crate::context;

type ServiceFuture = BoxFuture<'static, Result<Response<Body>, crate::ServiceError>>;

use crate::{Api,
     HelloGetResponse,
     ProjectGetResponse,
     ShowGetResponse,
     ProjectProjectIdBugAllGetResponse,
     ProjectProjectIdBugMyGetResponse,
     ProjectProjectIdBugRecordBugIdEventsGetResponse,
     ProjectProjectIdBugRecordBugIdShortNoteGetResponse,
     ProjectProjectIdBugRecordBugIdShowGetResponse,
     ProjectProjectIdCodeCommentCommentThreadIdGetResponse,
     ProjectProjectIdCodeCommentCommentThreadIdOptionsResponse,
     ProjectProjectIdCodeCommentCommentThreadIdPutResponse,
     ProjectProjectIdCodeCommentCommentThreadIdCommentIdDeleteResponse,
     ProjectProjectIdCodeCommentCommentThreadIdCommentIdGetResponse,
     ProjectProjectIdCodeCommentCommentThreadIdCommentIdOptionsResponse,
     ProjectProjectIdCodeCommentCommentThreadIdCommentIdPostResponse,
     ProjectProjectIdEntryEntryTypeGetResponse,
     ProjectProjectIdEntryShowEntryIdGetResponse,
     ProjectProjectIdEventGetResponse,
     ProjectProjectIdEventOptionsResponse,
     ProjectProjectIdEventPostResponse,
     ProjectProjectIdTaskAllGetResponse,
     ProjectProjectIdTaskMyGetResponse,
     ProjectProjectIdTaskRecordTaskIdDependGetResponse,
     ProjectProjectIdTaskRecordTaskIdEventsGetResponse,
     ProjectProjectIdTaskRecordTaskIdShortNoteGetResponse,
     ProjectProjectIdTaskRecordTaskIdShowGetResponse,
     ProjectProjectIdTaskRecordTaskIdSubTaskGetResponse
};

mod server_auth;

mod paths {
    use lazy_static::lazy_static;

    lazy_static! {
        pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![
            r"^/hello$",
            r"^/project$",
            r"^/project/(?P<projectId>[^/?#]*)/bug/all$",
            r"^/project/(?P<projectId>[^/?#]*)/bug/my$",
            r"^/project/(?P<projectId>[^/?#]*)/bug/record/(?P<bugId>[^/?#]*)/events$",
            r"^/project/(?P<projectId>[^/?#]*)/bug/record/(?P<bugId>[^/?#]*)/shortNote$",
            r"^/project/(?P<projectId>[^/?#]*)/bug/record/(?P<bugId>[^/?#]*)/show$",
            r"^/project/(?P<projectId>[^/?#]*)/codeComment/(?P<commentThreadId>[^/?#]*)$",
            r"^/project/(?P<projectId>[^/?#]*)/codeComment/(?P<commentThreadId>[^/?#]*)/(?P<commentId>[^/?#]*)$",
            r"^/project/(?P<projectId>[^/?#]*)/entry/show/(?P<entryId>[^/?#]*)$",
            r"^/project/(?P<projectId>[^/?#]*)/entry/(?P<entryType>[^/?#]*)$",
            r"^/project/(?P<projectId>[^/?#]*)/event$",
            r"^/project/(?P<projectId>[^/?#]*)/task/all$",
            r"^/project/(?P<projectId>[^/?#]*)/task/my$",
            r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/depend$",
            r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/events$",
            r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/shortNote$",
            r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/show$",
            r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/subTask$",
            r"^/show$"
        ])
        .expect("Unable to create global regex set");
    }
    pub(crate) static ID_HELLO: usize = 0;
    pub(crate) static ID_PROJECT: usize = 1;
    pub(crate) static ID_PROJECT_PROJECTID_BUG_ALL: usize = 2;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_BUG_ALL: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/bug/all$")
                .expect("Unable to create regex for PROJECT_PROJECTID_BUG_ALL");
    }
    pub(crate) static ID_PROJECT_PROJECTID_BUG_MY: usize = 3;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_BUG_MY: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/bug/my$")
                .expect("Unable to create regex for PROJECT_PROJECTID_BUG_MY");
    }
    pub(crate) static ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS: usize = 4;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/bug/record/(?P<bugId>[^/?#]*)/events$")
                .expect("Unable to create regex for PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS");
    }
    pub(crate) static ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE: usize = 5;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/bug/record/(?P<bugId>[^/?#]*)/shortNote$")
                .expect("Unable to create regex for PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE");
    }
    pub(crate) static ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW: usize = 6;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/bug/record/(?P<bugId>[^/?#]*)/show$")
                .expect("Unable to create regex for PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW");
    }
    pub(crate) static ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID: usize = 7;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/codeComment/(?P<commentThreadId>[^/?#]*)$")
                .expect("Unable to create regex for PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID");
    }
    pub(crate) static ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID: usize = 8;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/codeComment/(?P<commentThreadId>[^/?#]*)/(?P<commentId>[^/?#]*)$")
                .expect("Unable to create regex for PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID");
    }
    pub(crate) static ID_PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID: usize = 9;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/entry/show/(?P<entryId>[^/?#]*)$")
                .expect("Unable to create regex for PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID");
    }
    pub(crate) static ID_PROJECT_PROJECTID_ENTRY_ENTRYTYPE: usize = 10;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_ENTRY_ENTRYTYPE: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/entry/(?P<entryType>[^/?#]*)$")
                .expect("Unable to create regex for PROJECT_PROJECTID_ENTRY_ENTRYTYPE");
    }
    pub(crate) static ID_PROJECT_PROJECTID_EVENT: usize = 11;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_EVENT: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/event$")
                .expect("Unable to create regex for PROJECT_PROJECTID_EVENT");
    }
    pub(crate) static ID_PROJECT_PROJECTID_TASK_ALL: usize = 12;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_TASK_ALL: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/task/all$")
                .expect("Unable to create regex for PROJECT_PROJECTID_TASK_ALL");
    }
    pub(crate) static ID_PROJECT_PROJECTID_TASK_MY: usize = 13;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_TASK_MY: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/task/my$")
                .expect("Unable to create regex for PROJECT_PROJECTID_TASK_MY");
    }
    pub(crate) static ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND: usize = 14;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/depend$")
                .expect("Unable to create regex for PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND");
    }
    pub(crate) static ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS: usize = 15;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/events$")
                .expect("Unable to create regex for PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS");
    }
    pub(crate) static ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE: usize = 16;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/shortNote$")
                .expect("Unable to create regex for PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE");
    }
    pub(crate) static ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW: usize = 17;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/show$")
                .expect("Unable to create regex for PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW");
    }
    pub(crate) static ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK: usize = 18;
    lazy_static! {
        pub static ref REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK: regex::Regex =
            #[allow(clippy::invalid_regex)]
            regex::Regex::new(r"^/project/(?P<projectId>[^/?#]*)/task/record/(?P<taskId>[^/?#]*)/subTask$")
                .expect("Unable to create regex for PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK");
    }
    pub(crate) static ID_SHOW: usize = 19;
}


pub struct MakeService<T, C> where
    T: Api<C> + Clone + Send + 'static,
    C: Has<XSpanIdString>  + Send + Sync + 'static
{
    api_impl: T,
    marker: PhantomData<C>,
}

impl<T, C> MakeService<T, C> where
    T: Api<C> + Clone + Send + 'static,
    C: Has<XSpanIdString>  + Send + Sync + 'static
{
    pub fn new(api_impl: T) -> Self {
        MakeService {
            api_impl,
            marker: PhantomData
        }
    }
}

impl<T, C, Target> hyper::service::Service<Target> for MakeService<T, C> where
    T: Api<C> + Clone + Send + 'static,
    C: Has<XSpanIdString>  + Send + Sync + 'static
{
    type Response = Service<T, C>;
    type Error = crate::ServiceError;
    type Future = future::Ready<Result<Self::Response, Self::Error>>;

    fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
        Poll::Ready(Ok(()))
    }

    fn call(&mut self, target: Target) -> Self::Future {
        let service = Service::new(self.api_impl.clone());

        future::ok(service)
    }
}

fn method_not_allowed() -> Result<Response<Body>, crate::ServiceError> {
    Ok(
        Response::builder().status(StatusCode::METHOD_NOT_ALLOWED)
            .body(Body::empty())
            .expect("Unable to create Method Not Allowed response")
    )
}

pub struct Service<T, C> where
    T: Api<C> + Clone + Send + 'static,
    C: Has<XSpanIdString>  + Send + Sync + 'static
{
    api_impl: T,
    marker: PhantomData<C>,
}

impl<T, C> Service<T, C> where
    T: Api<C> + Clone + Send + 'static,
    C: Has<XSpanIdString>  + Send + Sync + 'static
{
    pub fn new(api_impl: T) -> Self {
        Service {
            api_impl,
            marker: PhantomData
        }
    }
}

impl<T, C> Clone for Service<T, C> where
    T: Api<C> + Clone + Send + 'static,
    C: Has<XSpanIdString>  + Send + Sync + 'static
{
    fn clone(&self) -> Self {
        Service {
            api_impl: self.api_impl.clone(),
            marker: self.marker,
        }
    }
}

impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
    T: Api<C> + Clone + Send + Sync + 'static,
    C: Has<XSpanIdString>  + Send + Sync + 'static
{
    type Response = Response<Body>;
    type Error = crate::ServiceError;
    type Future = ServiceFuture;

    fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), Self::Error>> {
        self.api_impl.poll_ready(cx)
    }

    fn call(&mut self, req: (Request<Body>, C)) -> Self::Future {
        async fn run<T, C>(
            mut api_impl: T,
            req: (Request<Body>, C),
        ) -> Result<Response<Body>, crate::ServiceError> where
            T: Api<C> + Clone + Send + 'static,
            C: Has<XSpanIdString>  + Send + Sync + 'static
        {
            let (request, context) = req;
            let (parts, body) = request.into_parts();
            let (method, uri, headers) = (parts.method, parts.uri, parts.headers);
            let path = paths::GLOBAL_REGEX_SET.matches(uri.path());

            match method {

            // HelloGet - GET /hello
            hyper::Method::GET if path.matched(paths::ID_HELLO) => {
                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.hello_get(
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                HelloGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("text/plain")
                                                            .expect("Unable to create Content-Type header for text/plain"));
                                                    // Plain text Body
                                                    let body = body;
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectGet - GET /project
            hyper::Method::GET if path.matched(paths::ID_PROJECT) => {
                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_get(
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ShowGet - GET /show
            hyper::Method::GET if path.matched(paths::ID_SHOW) => {
                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.show_get(
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ShowGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ShowGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdBugAllGet - GET /project/{projectId}/bug/all
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_ALL) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_BUG_ALL
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_BUG_ALL in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_BUG_ALL.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_offset = query_params.iter().filter(|e| e.0 == "offset").map(|e| e.1.clone())
                    .next();
                let param_offset = match param_offset {
                    Some(param_offset) => {
                        let param_offset =
                            <i32 as std::str::FromStr>::from_str
                                (&param_offset);
                        match param_offset {
                            Ok(param_offset) => Some(param_offset),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter offset - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter offset")),
                        }
                    },
                    None => None,
                };
                let param_offset = match param_offset {
                    Some(param_offset) => param_offset,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter offset"))
                        .expect("Unable to create Bad Request response for missing query parameter offset")),
                };
                let param_limit = query_params.iter().filter(|e| e.0 == "limit").map(|e| e.1.clone())
                    .next();
                let param_limit = match param_limit {
                    Some(param_limit) => {
                        let param_limit =
                            <i32 as std::str::FromStr>::from_str
                                (&param_limit);
                        match param_limit {
                            Ok(param_limit) => Some(param_limit),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter limit - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter limit")),
                        }
                    },
                    None => None,
                };
                let param_limit = match param_limit {
                    Some(param_limit) => param_limit,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter limit"))
                        .expect("Unable to create Bad Request response for missing query parameter limit")),
                };
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_bug_all_get(
                                            param_project_id,
                                            param_offset,
                                            param_limit,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdBugAllGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdBugAllGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdBugMyGet - GET /project/{projectId}/bug/my
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_MY) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_BUG_MY
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_BUG_MY in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_BUG_MY.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };
                let param_state = query_params.iter().filter(|e| e.0 == "state").map(|e| e.1.clone())
                    .next();
                let param_state = match param_state {
                    Some(param_state) => {
                        let param_state =
                            <models::ProjectProjectIdBugMyGetStateParameter as std::str::FromStr>::from_str
                                (&param_state);
                        match param_state {
                            Ok(param_state) => Some(param_state),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter state - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter state")),
                        }
                    },
                    None => None,
                };
                let param_state = match param_state {
                    Some(param_state) => param_state,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter state"))
                        .expect("Unable to create Bad Request response for missing query parameter state")),
                };

                                let result = api_impl.project_project_id_bug_my_get(
                                            param_project_id,
                                            param_access_token,
                                            param_state,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdBugMyGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdBugMyGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdBugRecordBugIdEventsGet - GET /project/{projectId}/bug/record/{bugId}/events
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_bug_id = match percent_encoding::percent_decode(path_params["bugId"].as_bytes()).decode_utf8() {
                    Ok(param_bug_id) => match param_bug_id.parse::<String>() {
                        Ok(param_bug_id) => param_bug_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter bugId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["bugId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_bug_record_bug_id_events_get(
                                            param_project_id,
                                            param_bug_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdBugRecordBugIdEventsGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdBugRecordBugIdEventsGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdBugRecordBugIdShortNoteGet - GET /project/{projectId}/bug/record/{bugId}/shortNote
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_bug_id = match percent_encoding::percent_decode(path_params["bugId"].as_bytes()).decode_utf8() {
                    Ok(param_bug_id) => match param_bug_id.parse::<String>() {
                        Ok(param_bug_id) => param_bug_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter bugId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["bugId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_bug_record_bug_id_short_note_get(
                                            param_project_id,
                                            param_bug_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdBugRecordBugIdShortNoteGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdBugRecordBugIdShortNoteGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdBugRecordBugIdShowGet - GET /project/{projectId}/bug/record/{bugId}/show
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_bug_id = match percent_encoding::percent_decode(path_params["bugId"].as_bytes()).decode_utf8() {
                    Ok(param_bug_id) => match param_bug_id.parse::<String>() {
                        Ok(param_bug_id) => param_bug_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter bugId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["bugId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_bug_record_bug_id_show_get(
                                            param_project_id,
                                            param_bug_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdBugRecordBugIdShowGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdBugRecordBugIdShowGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdCodeCommentCommentThreadIdGet - GET /project/{projectId}/codeComment/{commentThreadId}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_thread_id = match percent_encoding::percent_decode(path_params["commentThreadId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_thread_id) => match param_comment_thread_id.parse::<String>() {
                        Ok(param_comment_thread_id) => param_comment_thread_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentThreadId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentThreadId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_code_comment_comment_thread_id_get(
                                            param_project_id,
                                            param_comment_thread_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdCodeCommentCommentThreadIdGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdCodeCommentCommentThreadIdGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdCodeCommentCommentThreadIdOptions - OPTIONS /project/{projectId}/codeComment/{commentThreadId}
            hyper::Method::OPTIONS if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_thread_id = match percent_encoding::percent_decode(path_params["commentThreadId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_thread_id) => match param_comment_thread_id.parse::<String>() {
                        Ok(param_comment_thread_id) => param_comment_thread_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentThreadId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentThreadId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_code_comment_comment_thread_id_options(
                                            param_project_id,
                                            param_comment_thread_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdCodeCommentCommentThreadIdOptionsResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin,
                                                        access_control_allow_methods,
                                                        access_control_allow_headers,
                                                        access_control_allow_credentials
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }

                                                    if let Some(access_control_allow_methods) = access_control_allow_methods {
                                                    let access_control_allow_methods = match header::IntoHeaderValue(access_control_allow_methods).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_methods header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-methods"),
                                                        access_control_allow_methods
                                                    );
                                                    }

                                                    if let Some(access_control_allow_headers) = access_control_allow_headers {
                                                    let access_control_allow_headers = match header::IntoHeaderValue(access_control_allow_headers).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_headers header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-headers"),
                                                        access_control_allow_headers
                                                    );
                                                    }

                                                    if let Some(access_control_allow_credentials) = access_control_allow_credentials {
                                                    let access_control_allow_credentials = match header::IntoHeaderValue(access_control_allow_credentials).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_credentials header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-credentials"),
                                                        access_control_allow_credentials
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdCodeCommentCommentThreadIdPut - PUT /project/{projectId}/codeComment/{commentThreadId}
            hyper::Method::PUT if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_thread_id = match percent_encoding::percent_decode(path_params["commentThreadId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_thread_id) => match param_comment_thread_id.parse::<String>() {
                        Ok(param_comment_thread_id) => param_comment_thread_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentThreadId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentThreadId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                // Handle body parameters (note that non-required body parameters will ignore garbage
                // values, rather than causing a 400 response). Produce warning header and logs for
                // any unused fields.
                let result = body.into_raw().await;
                match result {
                     Ok(body) => {
                                let mut unused_elements : Vec<String> = vec![];
                                let param_project_project_id_code_comment_comment_thread_id_put_request: Option<models::ProjectProjectIdCodeCommentCommentThreadIdPutRequest> = if !body.is_empty() {
                                    let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
                                    match serde_ignored::deserialize(deserializer, |path| {
                                            warn!("Ignoring unknown field in body: {}", path);
                                            unused_elements.push(path.to_string());
                                    }) {
                                        Ok(param_project_project_id_code_comment_comment_thread_id_put_request) => param_project_project_id_code_comment_comment_thread_id_put_request,
                                        Err(_) => None,
                                    }
                                } else {
                                    None
                                };


                                let result = api_impl.project_project_id_code_comment_comment_thread_id_put(
                                            param_project_id,
                                            param_comment_thread_id,
                                            param_access_token,
                                            param_project_project_id_code_comment_comment_thread_id_put_request,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        if !unused_elements.is_empty() {
                                            response.headers_mut().insert(
                                                HeaderName::from_static("warning"),
                                                HeaderValue::from_str(format!("Ignoring unknown fields in body: {:?}", unused_elements).as_str())
                                                    .expect("Unable to create Warning header value"));
                                        }
                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdCodeCommentCommentThreadIdPutResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdCodeCommentCommentThreadIdPutResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
                            },
                            Err(e) => Ok(Response::builder()
                                                .status(StatusCode::BAD_REQUEST)
                                                .body(Body::from(format!("Unable to read body: {}", e)))
                                                .expect("Unable to create Bad Request response due to unable to read body")),
                        }
            },

            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdDelete - DELETE /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::DELETE if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_thread_id = match percent_encoding::percent_decode(path_params["commentThreadId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_thread_id) => match param_comment_thread_id.parse::<String>() {
                        Ok(param_comment_thread_id) => param_comment_thread_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentThreadId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentThreadId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_id = match percent_encoding::percent_decode(path_params["commentId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_id) => match param_comment_id.parse::<String>() {
                        Ok(param_comment_id) => param_comment_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_code_comment_comment_thread_id_comment_id_delete(
                                            param_project_id,
                                            param_comment_thread_id,
                                            param_comment_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdCodeCommentCommentThreadIdCommentIdDeleteResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdCodeCommentCommentThreadIdCommentIdDeleteResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdGet - GET /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_thread_id = match percent_encoding::percent_decode(path_params["commentThreadId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_thread_id) => match param_comment_thread_id.parse::<String>() {
                        Ok(param_comment_thread_id) => param_comment_thread_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentThreadId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentThreadId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_id = match percent_encoding::percent_decode(path_params["commentId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_id) => match param_comment_id.parse::<String>() {
                        Ok(param_comment_id) => param_comment_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_code_comment_comment_thread_id_comment_id_get(
                                            param_project_id,
                                            param_comment_thread_id,
                                            param_comment_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdCodeCommentCommentThreadIdCommentIdGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdCodeCommentCommentThreadIdCommentIdGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdOptions - OPTIONS /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::OPTIONS if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_thread_id = match percent_encoding::percent_decode(path_params["commentThreadId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_thread_id) => match param_comment_thread_id.parse::<String>() {
                        Ok(param_comment_thread_id) => param_comment_thread_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentThreadId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentThreadId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_id = match percent_encoding::percent_decode(path_params["commentId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_id) => match param_comment_id.parse::<String>() {
                        Ok(param_comment_id) => param_comment_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_code_comment_comment_thread_id_comment_id_options(
                                            param_project_id,
                                            param_comment_thread_id,
                                            param_comment_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdCodeCommentCommentThreadIdCommentIdOptionsResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin,
                                                        access_control_allow_methods,
                                                        access_control_allow_headers,
                                                        access_control_allow_credentials
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }

                                                    if let Some(access_control_allow_methods) = access_control_allow_methods {
                                                    let access_control_allow_methods = match header::IntoHeaderValue(access_control_allow_methods).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_methods header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-methods"),
                                                        access_control_allow_methods
                                                    );
                                                    }

                                                    if let Some(access_control_allow_headers) = access_control_allow_headers {
                                                    let access_control_allow_headers = match header::IntoHeaderValue(access_control_allow_headers).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_headers header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-headers"),
                                                        access_control_allow_headers
                                                    );
                                                    }

                                                    if let Some(access_control_allow_credentials) = access_control_allow_credentials {
                                                    let access_control_allow_credentials = match header::IntoHeaderValue(access_control_allow_credentials).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_credentials header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-credentials"),
                                                        access_control_allow_credentials
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdPost - POST /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::POST if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_thread_id = match percent_encoding::percent_decode(path_params["commentThreadId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_thread_id) => match param_comment_thread_id.parse::<String>() {
                        Ok(param_comment_thread_id) => param_comment_thread_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentThreadId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentThreadId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_comment_id = match percent_encoding::percent_decode(path_params["commentId"].as_bytes()).decode_utf8() {
                    Ok(param_comment_id) => match param_comment_id.parse::<String>() {
                        Ok(param_comment_id) => param_comment_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter commentId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["commentId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                // Handle body parameters (note that non-required body parameters will ignore garbage
                // values, rather than causing a 400 response). Produce warning header and logs for
                // any unused fields.
                let result = body.into_raw().await;
                match result {
                     Ok(body) => {
                                let mut unused_elements : Vec<String> = vec![];
                                let param_project_project_id_code_comment_comment_thread_id_put_request: Option<models::ProjectProjectIdCodeCommentCommentThreadIdPutRequest> = if !body.is_empty() {
                                    let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
                                    match serde_ignored::deserialize(deserializer, |path| {
                                            warn!("Ignoring unknown field in body: {}", path);
                                            unused_elements.push(path.to_string());
                                    }) {
                                        Ok(param_project_project_id_code_comment_comment_thread_id_put_request) => param_project_project_id_code_comment_comment_thread_id_put_request,
                                        Err(_) => None,
                                    }
                                } else {
                                    None
                                };


                                let result = api_impl.project_project_id_code_comment_comment_thread_id_comment_id_post(
                                            param_project_id,
                                            param_comment_thread_id,
                                            param_comment_id,
                                            param_access_token,
                                            param_project_project_id_code_comment_comment_thread_id_put_request,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        if !unused_elements.is_empty() {
                                            response.headers_mut().insert(
                                                HeaderName::from_static("warning"),
                                                HeaderValue::from_str(format!("Ignoring unknown fields in body: {:?}", unused_elements).as_str())
                                                    .expect("Unable to create Warning header value"));
                                        }
                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdCodeCommentCommentThreadIdCommentIdPostResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdCodeCommentCommentThreadIdCommentIdPostResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
                            },
                            Err(e) => Ok(Response::builder()
                                                .status(StatusCode::BAD_REQUEST)
                                                .body(Body::from(format!("Unable to read body: {}", e)))
                                                .expect("Unable to create Bad Request response due to unable to read body")),
                        }
            },

            // ProjectProjectIdEntryEntryTypeGet - GET /project/{projectId}/entry/{entryType}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_ENTRY_ENTRYTYPE) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_ENTRY_ENTRYTYPE
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_ENTRY_ENTRYTYPE in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_ENTRY_ENTRYTYPE.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_entry_type = match percent_encoding::percent_decode(path_params["entryType"].as_bytes()).decode_utf8() {
                    Ok(param_entry_type) => match param_entry_type.parse::<models::ProjectProjectIdEntryEntryTypeGetEntryTypeParameter>() {
                        Ok(param_entry_type) => param_entry_type,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter entryType: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["entryType"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_entry_entry_type_get(
                                            param_project_id,
                                            param_entry_type,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdEntryEntryTypeGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdEntryEntryTypeGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdEntryShowEntryIdGet - GET /project/{projectId}/entry/show/{entryId}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_entry_id = match percent_encoding::percent_decode(path_params["entryId"].as_bytes()).decode_utf8() {
                    Ok(param_entry_id) => match param_entry_id.parse::<String>() {
                        Ok(param_entry_id) => param_entry_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter entryId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["entryId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_entry_show_entry_id_get(
                                            param_project_id,
                                            param_entry_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdEntryShowEntryIdGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdEntryShowEntryIdGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdEventGet - GET /project/{projectId}/event
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_EVENT) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_EVENT
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_EVENT in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_EVENT.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_from_time = query_params.iter().filter(|e| e.0 == "fromTime").map(|e| e.1.clone())
                    .next();
                let param_from_time = match param_from_time {
                    Some(param_from_time) => {
                        let param_from_time =
                            <i64 as std::str::FromStr>::from_str
                                (&param_from_time);
                        match param_from_time {
                            Ok(param_from_time) => Some(param_from_time),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter fromTime - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter fromTime")),
                        }
                    },
                    None => None,
                };
                let param_from_time = match param_from_time {
                    Some(param_from_time) => param_from_time,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter fromTime"))
                        .expect("Unable to create Bad Request response for missing query parameter fromTime")),
                };
                let param_to_time = query_params.iter().filter(|e| e.0 == "toTime").map(|e| e.1.clone())
                    .next();
                let param_to_time = match param_to_time {
                    Some(param_to_time) => {
                        let param_to_time =
                            <i64 as std::str::FromStr>::from_str
                                (&param_to_time);
                        match param_to_time {
                            Ok(param_to_time) => Some(param_to_time),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter toTime - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter toTime")),
                        }
                    },
                    None => None,
                };
                let param_to_time = match param_to_time {
                    Some(param_to_time) => param_to_time,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter toTime"))
                        .expect("Unable to create Bad Request response for missing query parameter toTime")),
                };
                let param_user_id = query_params.iter().filter(|e| e.0 == "userId").map(|e| e.1.clone())
                    .next();
                let param_user_id = match param_user_id {
                    Some(param_user_id) => {
                        let param_user_id =
                            <String as std::str::FromStr>::from_str
                                (&param_user_id);
                        match param_user_id {
                            Ok(param_user_id) => Some(param_user_id),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter userId - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter userId")),
                        }
                    },
                    None => None,
                };
                let param_offset = query_params.iter().filter(|e| e.0 == "offset").map(|e| e.1.clone())
                    .next();
                let param_offset = match param_offset {
                    Some(param_offset) => {
                        let param_offset =
                            <i32 as std::str::FromStr>::from_str
                                (&param_offset);
                        match param_offset {
                            Ok(param_offset) => Some(param_offset),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter offset - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter offset")),
                        }
                    },
                    None => None,
                };
                let param_offset = match param_offset {
                    Some(param_offset) => param_offset,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter offset"))
                        .expect("Unable to create Bad Request response for missing query parameter offset")),
                };
                let param_limit = query_params.iter().filter(|e| e.0 == "limit").map(|e| e.1.clone())
                    .next();
                let param_limit = match param_limit {
                    Some(param_limit) => {
                        let param_limit =
                            <i32 as std::str::FromStr>::from_str
                                (&param_limit);
                        match param_limit {
                            Ok(param_limit) => Some(param_limit),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter limit - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter limit")),
                        }
                    },
                    None => None,
                };
                let param_limit = match param_limit {
                    Some(param_limit) => param_limit,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter limit"))
                        .expect("Unable to create Bad Request response for missing query parameter limit")),
                };
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_event_get(
                                            param_project_id,
                                            param_from_time,
                                            param_to_time,
                                            param_offset,
                                            param_limit,
                                            param_access_token,
                                            param_user_id,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdEventGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdEventGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdEventOptions - OPTIONS /project/{projectId}/event
            hyper::Method::OPTIONS if path.matched(paths::ID_PROJECT_PROJECTID_EVENT) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_EVENT
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_EVENT in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_EVENT.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_event_options(
                                            param_project_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdEventOptionsResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin,
                                                        access_control_allow_methods,
                                                        access_control_allow_headers,
                                                        access_control_allow_credentials
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }

                                                    if let Some(access_control_allow_methods) = access_control_allow_methods {
                                                    let access_control_allow_methods = match header::IntoHeaderValue(access_control_allow_methods).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_methods header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-methods"),
                                                        access_control_allow_methods
                                                    );
                                                    }

                                                    if let Some(access_control_allow_headers) = access_control_allow_headers {
                                                    let access_control_allow_headers = match header::IntoHeaderValue(access_control_allow_headers).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_headers header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-headers"),
                                                        access_control_allow_headers
                                                    );
                                                    }

                                                    if let Some(access_control_allow_credentials) = access_control_allow_credentials {
                                                    let access_control_allow_credentials = match header::IntoHeaderValue(access_control_allow_credentials).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_credentials header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-credentials"),
                                                        access_control_allow_credentials
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdEventPost - POST /project/{projectId}/event
            hyper::Method::POST if path.matched(paths::ID_PROJECT_PROJECTID_EVENT) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_EVENT
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_EVENT in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_EVENT.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                // Handle body parameters (note that non-required body parameters will ignore garbage
                // values, rather than causing a 400 response). Produce warning header and logs for
                // any unused fields.
                let result = body.into_raw().await;
                match result {
                     Ok(body) => {
                                let mut unused_elements : Vec<String> = vec![];
                                let param_project_project_id_event_post_request: Option<models::ProjectProjectIdEventPostRequest> = if !body.is_empty() {
                                    let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
                                    match serde_ignored::deserialize(deserializer, |path| {
                                            warn!("Ignoring unknown field in body: {}", path);
                                            unused_elements.push(path.to_string());
                                    }) {
                                        Ok(param_project_project_id_event_post_request) => param_project_project_id_event_post_request,
                                        Err(_) => None,
                                    }
                                } else {
                                    None
                                };


                                let result = api_impl.project_project_id_event_post(
                                            param_project_id,
                                            param_access_token,
                                            param_project_project_id_event_post_request,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        if !unused_elements.is_empty() {
                                            response.headers_mut().insert(
                                                HeaderName::from_static("warning"),
                                                HeaderValue::from_str(format!("Ignoring unknown fields in body: {:?}", unused_elements).as_str())
                                                    .expect("Unable to create Warning header value"));
                                        }
                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdEventPostResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdEventPostResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
                            },
                            Err(e) => Ok(Response::builder()
                                                .status(StatusCode::BAD_REQUEST)
                                                .body(Body::from(format!("Unable to read body: {}", e)))
                                                .expect("Unable to create Bad Request response due to unable to read body")),
                        }
            },

            // ProjectProjectIdTaskAllGet - GET /project/{projectId}/task/all
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_ALL) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_TASK_ALL
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_TASK_ALL in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_TASK_ALL.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_offset = query_params.iter().filter(|e| e.0 == "offset").map(|e| e.1.clone())
                    .next();
                let param_offset = match param_offset {
                    Some(param_offset) => {
                        let param_offset =
                            <i32 as std::str::FromStr>::from_str
                                (&param_offset);
                        match param_offset {
                            Ok(param_offset) => Some(param_offset),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter offset - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter offset")),
                        }
                    },
                    None => None,
                };
                let param_offset = match param_offset {
                    Some(param_offset) => param_offset,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter offset"))
                        .expect("Unable to create Bad Request response for missing query parameter offset")),
                };
                let param_limit = query_params.iter().filter(|e| e.0 == "limit").map(|e| e.1.clone())
                    .next();
                let param_limit = match param_limit {
                    Some(param_limit) => {
                        let param_limit =
                            <i32 as std::str::FromStr>::from_str
                                (&param_limit);
                        match param_limit {
                            Ok(param_limit) => Some(param_limit),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter limit - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter limit")),
                        }
                    },
                    None => None,
                };
                let param_limit = match param_limit {
                    Some(param_limit) => param_limit,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter limit"))
                        .expect("Unable to create Bad Request response for missing query parameter limit")),
                };
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_task_all_get(
                                            param_project_id,
                                            param_offset,
                                            param_limit,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdTaskAllGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdTaskAllGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdTaskMyGet - GET /project/{projectId}/task/my
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_MY) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_TASK_MY
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_TASK_MY in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_TASK_MY.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_state = query_params.iter().filter(|e| e.0 == "state").map(|e| e.1.clone())
                    .next();
                let param_state = match param_state {
                    Some(param_state) => {
                        let param_state =
                            <models::ProjectProjectIdTaskMyGetStateParameter as std::str::FromStr>::from_str
                                (&param_state);
                        match param_state {
                            Ok(param_state) => Some(param_state),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter state - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter state")),
                        }
                    },
                    None => None,
                };
                let param_state = match param_state {
                    Some(param_state) => param_state,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter state"))
                        .expect("Unable to create Bad Request response for missing query parameter state")),
                };
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_task_my_get(
                                            param_project_id,
                                            param_state,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdTaskMyGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdTaskMyGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdTaskRecordTaskIdDependGet - GET /project/{projectId}/task/record/{taskId}/depend
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_task_id = match percent_encoding::percent_decode(path_params["taskId"].as_bytes()).decode_utf8() {
                    Ok(param_task_id) => match param_task_id.parse::<String>() {
                        Ok(param_task_id) => param_task_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter taskId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["taskId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_task_record_task_id_depend_get(
                                            param_project_id,
                                            param_task_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdTaskRecordTaskIdDependGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdTaskRecordTaskIdDependGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdTaskRecordTaskIdEventsGet - GET /project/{projectId}/task/record/{taskId}/events
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_task_id = match percent_encoding::percent_decode(path_params["taskId"].as_bytes()).decode_utf8() {
                    Ok(param_task_id) => match param_task_id.parse::<String>() {
                        Ok(param_task_id) => param_task_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter taskId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["taskId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_task_record_task_id_events_get(
                                            param_project_id,
                                            param_task_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdTaskRecordTaskIdEventsGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdTaskRecordTaskIdEventsGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdTaskRecordTaskIdShortNoteGet - GET /project/{projectId}/task/record/{taskId}/shortNote
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_task_id = match percent_encoding::percent_decode(path_params["taskId"].as_bytes()).decode_utf8() {
                    Ok(param_task_id) => match param_task_id.parse::<String>() {
                        Ok(param_task_id) => param_task_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter taskId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["taskId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_task_record_task_id_short_note_get(
                                            param_project_id,
                                            param_task_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdTaskRecordTaskIdShortNoteGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdTaskRecordTaskIdShortNoteGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdTaskRecordTaskIdShowGet - GET /project/{projectId}/task/record/{taskId}/show
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_task_id = match percent_encoding::percent_decode(path_params["taskId"].as_bytes()).decode_utf8() {
                    Ok(param_task_id) => match param_task_id.parse::<String>() {
                        Ok(param_task_id) => param_task_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter taskId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["taskId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_task_record_task_id_show_get(
                                            param_project_id,
                                            param_task_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdTaskRecordTaskIdShowGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdTaskRecordTaskIdShowGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            // ProjectProjectIdTaskRecordTaskIdSubTaskGet - GET /project/{projectId}/task/record/{taskId}/subTask
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK) => {
                // Path parameters
                let path: &str = uri.path();
                let path_params =
                    paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK
                    .captures(path)
                    .unwrap_or_else(||
                        panic!("Path {} matched RE PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK in set but failed match against \"{}\"", path, paths::REGEX_PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK.as_str())
                    );

                let param_project_id = match percent_encoding::percent_decode(path_params["projectId"].as_bytes()).decode_utf8() {
                    Ok(param_project_id) => match param_project_id.parse::<String>() {
                        Ok(param_project_id) => param_project_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter projectId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["projectId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                let param_task_id = match percent_encoding::percent_decode(path_params["taskId"].as_bytes()).decode_utf8() {
                    Ok(param_task_id) => match param_task_id.parse::<String>() {
                        Ok(param_task_id) => param_task_id,
                        Err(e) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't parse path parameter taskId: {}", e)))
                                        .expect("Unable to create Bad Request response for invalid path parameter")),
                    },
                    Err(_) => return Ok(Response::builder()
                                        .status(StatusCode::BAD_REQUEST)
                                        .body(Body::from(format!("Couldn't percent-decode path parameter as UTF-8: {}", &path_params["taskId"])))
                                        .expect("Unable to create Bad Request response for invalid percent decode"))
                };

                // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
                let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
                let param_access_token = query_params.iter().filter(|e| e.0 == "accessToken").map(|e| e.1.clone())
                    .next();
                let param_access_token = match param_access_token {
                    Some(param_access_token) => {
                        let param_access_token =
                            <String as std::str::FromStr>::from_str
                                (&param_access_token);
                        match param_access_token {
                            Ok(param_access_token) => Some(param_access_token),
                            Err(e) => return Ok(Response::builder()
                                .status(StatusCode::BAD_REQUEST)
                                .body(Body::from(format!("Couldn't parse query parameter accessToken - doesn't match schema: {}", e)))
                                .expect("Unable to create Bad Request response for invalid query parameter accessToken")),
                        }
                    },
                    None => None,
                };
                let param_access_token = match param_access_token {
                    Some(param_access_token) => param_access_token,
                    None => return Ok(Response::builder()
                        .status(StatusCode::BAD_REQUEST)
                        .body(Body::from("Missing required query parameter accessToken"))
                        .expect("Unable to create Bad Request response for missing query parameter accessToken")),
                };

                                let result = api_impl.project_project_id_task_record_task_id_sub_task_get(
                                            param_project_id,
                                            param_task_id,
                                            param_access_token,
                                        &context
                                    ).await;
                                let mut response = Response::new(Body::empty());
                                response.headers_mut().insert(
                                            HeaderName::from_static("x-span-id"),
                                            HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().as_str())
                                                .expect("Unable to create X-Span-ID header value"));

                                        match result {
                                            Ok(rsp) => match rsp {
                                                ProjectProjectIdTaskRecordTaskIdSubTaskGetResponse::Status200
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                                ProjectProjectIdTaskRecordTaskIdSubTaskGetResponse::Status500
                                                    {
                                                        body,
                                                        access_control_allow_origin
                                                    }
                                                => {
                                                    *response.status_mut() = StatusCode::from_u16(500).expect("Unable to turn 500 into a StatusCode");

                                                    if let Some(access_control_allow_origin) = access_control_allow_origin {
                                                    let access_control_allow_origin = match header::IntoHeaderValue(access_control_allow_origin).try_into() {
                                                        Ok(val) => val,
                                                        Err(e) => {
                                                            return Ok(Response::builder()
                                                                    .status(StatusCode::INTERNAL_SERVER_ERROR)
                                                                    .body(Body::from(format!("An internal server error occurred handling access_control_allow_origin header - {}", e)))
                                                                    .expect("Unable to create Internal Server Error for invalid response header"))
                                                        }
                                                    };

                                                    response.headers_mut().insert(
                                                        HeaderName::from_static("access-control-allow-origin"),
                                                        access_control_allow_origin
                                                    );
                                                    }
                                                    response.headers_mut().insert(
                                                        CONTENT_TYPE,
                                                        HeaderValue::from_str("application/json")
                                                            .expect("Unable to create Content-Type header for application/json"));
                                                    // JSON Body
                                                    let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
                                                    *response.body_mut() = Body::from(body);

                                                },
                                            },
                                            Err(_) => {
                                                // Application code returned an error. This should not happen, as the implementation should
                                                // return a valid response.
                                                *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
                                                *response.body_mut() = Body::from("An internal error occurred");
                                            },
                                        }

                                        Ok(response)
            },

            _ if path.matched(paths::ID_HELLO) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_BUG_ALL) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_BUG_MY) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_ENTRY_ENTRYTYPE) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_EVENT) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_TASK_ALL) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_TASK_MY) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW) => method_not_allowed(),
            _ if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK) => method_not_allowed(),
            _ if path.matched(paths::ID_SHOW) => method_not_allowed(),
                _ => Ok(Response::builder().status(StatusCode::NOT_FOUND)
                        .body(Body::empty())
                        .expect("Unable to create Not Found response"))
            }
        }
        Box::pin(run(
            self.api_impl.clone(),
            req,
        ))
    }
}

/// Request parser for `Api`.
pub struct ApiRequestParser;
impl<T> RequestParser<T> for ApiRequestParser {
    fn parse_operation_id(request: &Request<T>) -> Option<&'static str> {
        let path = paths::GLOBAL_REGEX_SET.matches(request.uri().path());
        match *request.method() {
            // HelloGet - GET /hello
            hyper::Method::GET if path.matched(paths::ID_HELLO) => Some("HelloGet"),
            // ProjectGet - GET /project
            hyper::Method::GET if path.matched(paths::ID_PROJECT) => Some("ProjectGet"),
            // ShowGet - GET /show
            hyper::Method::GET if path.matched(paths::ID_SHOW) => Some("ShowGet"),
            // ProjectProjectIdBugAllGet - GET /project/{projectId}/bug/all
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_ALL) => Some("ProjectProjectIdBugAllGet"),
            // ProjectProjectIdBugMyGet - GET /project/{projectId}/bug/my
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_MY) => Some("ProjectProjectIdBugMyGet"),
            // ProjectProjectIdBugRecordBugIdEventsGet - GET /project/{projectId}/bug/record/{bugId}/events
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_EVENTS) => Some("ProjectProjectIdBugRecordBugIdEventsGet"),
            // ProjectProjectIdBugRecordBugIdShortNoteGet - GET /project/{projectId}/bug/record/{bugId}/shortNote
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHORTNOTE) => Some("ProjectProjectIdBugRecordBugIdShortNoteGet"),
            // ProjectProjectIdBugRecordBugIdShowGet - GET /project/{projectId}/bug/record/{bugId}/show
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_BUG_RECORD_BUGID_SHOW) => Some("ProjectProjectIdBugRecordBugIdShowGet"),
            // ProjectProjectIdCodeCommentCommentThreadIdGet - GET /project/{projectId}/codeComment/{commentThreadId}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID) => Some("ProjectProjectIdCodeCommentCommentThreadIdGet"),
            // ProjectProjectIdCodeCommentCommentThreadIdOptions - OPTIONS /project/{projectId}/codeComment/{commentThreadId}
            hyper::Method::OPTIONS if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID) => Some("ProjectProjectIdCodeCommentCommentThreadIdOptions"),
            // ProjectProjectIdCodeCommentCommentThreadIdPut - PUT /project/{projectId}/codeComment/{commentThreadId}
            hyper::Method::PUT if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID) => Some("ProjectProjectIdCodeCommentCommentThreadIdPut"),
            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdDelete - DELETE /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::DELETE if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => Some("ProjectProjectIdCodeCommentCommentThreadIdCommentIdDelete"),
            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdGet - GET /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => Some("ProjectProjectIdCodeCommentCommentThreadIdCommentIdGet"),
            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdOptions - OPTIONS /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::OPTIONS if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => Some("ProjectProjectIdCodeCommentCommentThreadIdCommentIdOptions"),
            // ProjectProjectIdCodeCommentCommentThreadIdCommentIdPost - POST /project/{projectId}/codeComment/{commentThreadId}/{commentId}
            hyper::Method::POST if path.matched(paths::ID_PROJECT_PROJECTID_CODECOMMENT_COMMENTTHREADID_COMMENTID) => Some("ProjectProjectIdCodeCommentCommentThreadIdCommentIdPost"),
            // ProjectProjectIdEntryEntryTypeGet - GET /project/{projectId}/entry/{entryType}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_ENTRY_ENTRYTYPE) => Some("ProjectProjectIdEntryEntryTypeGet"),
            // ProjectProjectIdEntryShowEntryIdGet - GET /project/{projectId}/entry/show/{entryId}
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_ENTRY_SHOW_ENTRYID) => Some("ProjectProjectIdEntryShowEntryIdGet"),
            // ProjectProjectIdEventGet - GET /project/{projectId}/event
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_EVENT) => Some("ProjectProjectIdEventGet"),
            // ProjectProjectIdEventOptions - OPTIONS /project/{projectId}/event
            hyper::Method::OPTIONS if path.matched(paths::ID_PROJECT_PROJECTID_EVENT) => Some("ProjectProjectIdEventOptions"),
            // ProjectProjectIdEventPost - POST /project/{projectId}/event
            hyper::Method::POST if path.matched(paths::ID_PROJECT_PROJECTID_EVENT) => Some("ProjectProjectIdEventPost"),
            // ProjectProjectIdTaskAllGet - GET /project/{projectId}/task/all
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_ALL) => Some("ProjectProjectIdTaskAllGet"),
            // ProjectProjectIdTaskMyGet - GET /project/{projectId}/task/my
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_MY) => Some("ProjectProjectIdTaskMyGet"),
            // ProjectProjectIdTaskRecordTaskIdDependGet - GET /project/{projectId}/task/record/{taskId}/depend
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_DEPEND) => Some("ProjectProjectIdTaskRecordTaskIdDependGet"),
            // ProjectProjectIdTaskRecordTaskIdEventsGet - GET /project/{projectId}/task/record/{taskId}/events
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_EVENTS) => Some("ProjectProjectIdTaskRecordTaskIdEventsGet"),
            // ProjectProjectIdTaskRecordTaskIdShortNoteGet - GET /project/{projectId}/task/record/{taskId}/shortNote
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHORTNOTE) => Some("ProjectProjectIdTaskRecordTaskIdShortNoteGet"),
            // ProjectProjectIdTaskRecordTaskIdShowGet - GET /project/{projectId}/task/record/{taskId}/show
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SHOW) => Some("ProjectProjectIdTaskRecordTaskIdShowGet"),
            // ProjectProjectIdTaskRecordTaskIdSubTaskGet - GET /project/{projectId}/task/record/{taskId}/subTask
            hyper::Method::GET if path.matched(paths::ID_PROJECT_PROJECTID_TASK_RECORD_TASKID_SUBTASK) => Some("ProjectProjectIdTaskRecordTaskIdSubTaskGet"),
            _ => None,
        }
    }
}
